import request, {headers} from '@/utils/request'
import qs from 'qs'

export default {
  groups(){return request.get('/git/groups')},
  cloneRepository(group,url){return request.get(`/git/cloneRepository?group=${group}&url=${url}`)},
  groupRepositorys(){return request.get('/git/compose/groupAndRepo')},
  branchs(group,repository){return request.get(`/git/branchs?group=${group}&repository=${repository}`)},
  switchBranch(group,repository,branchName){return request.get(`/git/switchBranch?group=${group}&repository=${repository}&branchName=${branchName}`)},
  pull(group,repository){return request.get(`/git/pull?group=${group}&repository=${repository}`)},
  commits(group,repository){return request.get(`/git/commits?group=${group}&repository=${repository}`)},
  changeFiles(input){return request.post('/git/changeFiles',input,headers.json)},
  changeFilesV2(input){return request.post('/git/v2/changeFiles',input,headers.json)},
  createPatch(input){return request.post('/git/createPatch',input,headers.json)},
  createPatchV2(input){return request.post('/git/v2/createPatch',input,headers.json)},
  pomFiles(group,repository){return request.get('/git/poms',{params:{group,repository}})},
  compile(websocketId,group,repository,pomRelativePath){return request.get('/git/compile',{params:{websocketId,group,repository,pomRelativePath}})},
  modules(group,repository){return request.get('/git/modules',{params:{group,repository}})},
  lock(group,repository){return request.get('/git/lock',{params:{group,repository}})},
  unLock(group,repository,force){return request.get('/git/unLock',{params:{group,repository,force}})},
  newCompileTime(group,repository){return request.get('/git/newCompileTime',{params:{group,repository}})}
}
